package com.auth.controller;

import com.auth.MyUserDetails;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping
public class IndexController {
    @GetMapping("/")
    public String index(Authentication authentication){
        return "hello index" + authentication.getName();
    }

    @GetMapping("me")
    @ResponseBody
    public MyUserDetails authentication(){
        MyUserDetails myUserDetails = new MyUserDetails();
        myUserDetails.setUsername("ding");
        myUserDetails.setPassword("test");
        return myUserDetails;
    }
}
